package com.huanhong.hik.util;

import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.io.UnsupportedEncodingException;

@Slf4j
public class Tools {
    public static String DLL_PATH;

    static {
        String path = (Tools.class.getResource("/").getPath()).replaceAll("%20", " ").substring(1).replace("/", File.separator);
        try {
            DLL_PATH = java.net.URLDecoder.decode(path, "utf-8");
            if (DLL_PATH.contains("!\\BOOT-INF\\classes!\\")) {
                DLL_PATH = DLL_PATH.replace("!\\BOOT-INF\\classes!\\", "");
                DLL_PATH = DLL_PATH.substring(5, DLL_PATH.lastIndexOf("\\") + 1);
            }
            log.info("DLL_PATH:{}", DLL_PATH);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
